#![allow(dead_code)]

struct AsLrn {}

impl AsLrn {
    pub fn hello() {
        println!("As learning!");
    }
}

#[cfg(test)]
mod tests {
    #[test]
    fn convert_test() {
        let thing1 = 89.0 as u8;
        assert_eq!('B' as u32, 66);
        assert_eq!(thing1 as char, 'Y');
        let thing2: f32 = thing1 as f32 + 10.5;
        assert_eq!(true as u8 + thing2 as u8, 100);
        // as 指针, 指针改变值
        #[allow(invalid_reference_casting)]
        unsafe {
            let ptr = &thing1 as *const u8 as *mut u8;
            *ptr = 88;
        }
        assert_eq!(thing1, 88);
    }
}
